export enum TreasuryPrizeOwnerType {
  treasury = 'treasury',
  personal = 'personal'
}

export const TreasuryPrizeOwnerTypeName = {
  [TreasuryPrizeOwnerType.treasury]: '公会',
  [TreasuryPrizeOwnerType.personal]: '个人'
}

export const TreasuryPrizeOwnerTypeOptions = [
  {
    value: TreasuryPrizeOwnerType.treasury,
    name: '公会'
  },
  {
    value: TreasuryPrizeOwnerType.personal,
    name: '个人'
  }
]

export enum TreasuryPrizeOpenMode {
  person= 'person', // 满人开奖
  time = 'time' // 定时开奖
}

export const TreasuryPrizeOpenModeName = {
  [TreasuryPrizeOpenMode.person]: '满人开奖',
  [TreasuryPrizeOpenMode.time]: '定时开奖'
}

export const TreasuryPrizeOpenModeOptions = [
  {
    value: TreasuryPrizeOpenMode.person,
    name: '满人开奖'
  },
  {
    value: TreasuryPrizeOpenMode.time,
    name: '定时开奖'
  }
]

export enum TreasuryPrizeWinMode {
  person = 'person', // 人数
  rate = 'rate' // 概率
}

export const TreasuryPrizeWinModeName = {
  [TreasuryPrizeWinMode.person]: '人数',
  [TreasuryPrizeWinMode.rate]: '概率'
}

export const TreasuryPrizeWinModeOptions = [
  {
    value: TreasuryPrizeWinMode.person,
    name: '人数'
  },
  {
    value: TreasuryPrizeWinMode.rate,
    name: '概率'
  }
]

export enum TreasuryPrizeAwardMode {
  // 手动
  manual = 'manual',
  // 自动
  auto = 'auto'
}

export const TreasuryPrizeAwardModeName = {
  [TreasuryPrizeAwardMode.manual]: '手动',
  [TreasuryPrizeAwardMode.auto]: '自动'
}

export const TreasuryPrizeAwardModeOptions = [
  {
    value: TreasuryPrizeAwardMode.auto,
    name: '自动'
  },
  {
    value: TreasuryPrizeAwardMode.manual,
    name: '手动'
  }
]

export enum TreasuryPrizeStatus {
  open = 'open', // 进行中
  frozen = 'frozen', // 冻结
  complete = 'complete' // 已开奖
}

export const TreasuryPrizeStatusName = {
  [TreasuryPrizeStatus.open]: '进行中',
  [TreasuryPrizeStatus.frozen]: '冻结',
  [TreasuryPrizeStatus.complete]: '已开奖'
}

export interface TreasuryPrize {
  treasuryPrizeId: number; // 奖品id

  treasuryId: number; // 仓库id
  createUserId: number; // 创建用户id
  createUserName: string; // 创建用户名

  name: string; // 奖品名称
  image: string; // 奖品图片
  description: string; // 奖品描述
  worth: number; // 奖品积分
  ownerType: TreasuryPrizeOwnerType; // 创建者类型
  cost: number; // 抽奖所需积分
  isLimit: boolean; // 是否限定

  openMode: TreasuryPrizeOpenMode; // 开奖方式:
  personNum?: number; // 满人开奖人数
  openTime?: string; // 定时开奖时间
  
  winMode: TreasuryPrizeWinMode; // 中奖方式
  winNum?: number; // 中奖人数
  winRate?: number; // 中奖概率
  curNum: number; // 当前参与人数

  awardMode: TreasuryPrizeAwardMode; // 奖品类型
  limit: boolean; // 是否限定
  status: TreasuryPrizeStatus; // 奖品状态
}